/*
 * Copyright (c) 2022  by Junzhao
 * THIS FILE IS PART OF JAVASE Song Huongkang PROJECT
 * All Rights Reserved.
 */

package 练习.test08;

public class test08 {
    public static void main(String[] args) {
        Girl girl =new Girl("xiaowang",20);
        Boy boy =new Boy("xiaoming",24);
        girl.marry(boy);
        boy.marry(girl);
    }
}
class Boy {
    private String name;
    private int age;

    public void setAge(int age) {
        this.age = age;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public Boy(String name, int age) {
        this.name = name;
        this.age = age;
    }


    public void marry(Girl girl) {
        if (girl.getAge() >= 22) {
            System.out.println("我要娶" + girl.getName());
        } else {
            System.out.println("很刑！");
        }

    }
}
class Girl{

    private String name;
    private int age;

    public void setAge(int age) {
        this.age = age;
    }
    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }
    public int getAge() {
        return age;
    }



    public Girl(String name, int age) {
        this.name = name;
        this.age = age;
    }
    public void marry(Boy boy){
        if (getAge()>=22&&boy.getAge()>=20){
            System.out.println("我要嫁给" + boy.getName());
        }else{
            System.out.println("行就不刑");
        }
    }
}
